<template>
  <div class="likede-page">
    <el-row :gutter="20">
      <el-col :span="16">
        <el-row :gutter="20">
          <el-col :span="12">
            <div class="grid-content bg-purple-left">
              <div class="header">
                <div class="title">
                  工单统计
                  <span>{{start}}~{{end}}</span>
                </div>
              </div>
              <el-row type="flex">
                <el-col :span="6" style="margin-left: 20px">
                  <div class="count">417</div>
                  <div class="des">工单总数 (个)</div>
                </el-col>
                <el-col :span="6" style="margin-left: 20px">
                  <div class="count">0</div>
                  <div class="des">完成工单 (个)</div>
                </el-col>
                <el-col :span="6" style="margin-left: 20px">
                  <div class="count">0</div>
                  <div class="des">进行工单 (个)</div>
                </el-col>
                <el-col :span="6" style="margin-left: 20px">
                  <div class="count">409</div>
                  <div class="des">取消工单 (个)</div>
                </el-col>
              </el-row>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="grid-content bg-purple-right">
              <div class="header">
                <div class="title">
                  销售统计
                  <span>{{start}}~{{end}}</span>
                </div>
              </div>
              <el-row type="flex">
                <el-col :span="12" style="margin-left: 80px">
                  <div class="count">417</div>
                  <div class="des">订单量 (个)</div>
                </el-col>
                <el-col :span="12" style="margin-left: 80px">
                  <div class="count">0</div>
                  <div class="des">销售额 (万元)</div>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24" style="background-color:#ffffff">
            <el-row :gutter="20">
          <el-col :span="12">
            <div class="echarts-left"></div>
            </el-col>
             <el-col :span="12">
            <div class="echarts-right"></div>
            </el-col>
            </el-row>
            </el-col>

        </el-row>
      </el-col>
      <el-col :span="8">
        <div class="rankings">
          <div class="header">
            <div class="title">
              商品热榜
              <span>{{start}}~{{end}}</span>
            </div>
          </div>
          <ul>
            <li v-for="(item,index) in list" :key="index">
              <div v-if="index<3"  :class="`logo${index}`">{{index+1}}</div>
              <div v-else class="logo3">{{index+1}}</div>
              <div class="goods">{{item.skuName}}</div>
              <div class="cost">{{item.count}}单</div>
            </li>
             <!-- <li>
              <div class="logo1">2</div>
              <div class="goods">怡宝</div>
              <div class="cost">1094单</div>
            </li>
             <li>
              <div class="logo2">3</div>
              <div class="goods">怡宝</div>
              <div class="cost">1094单</div>
            </li>
             <li>
              <div class="logo3">4</div>
              <div class="goods">怡宝</div>
              <div class="cost">1094单</div>
            </li>
            <li>
              <div class="logo3">3</div>
              <div class="goods">怡宝</div>
              <div class="cost">1094单</div>
            </li>
            <li>
              <div class="logo3">3</div>
              <div class="goods">怡宝</div>
              <div class="cost">1094单</div>
            </li>
            <li>
              <div class="logo3">3</div>
              <div class="goods">怡宝</div>
              <div class="cost">1094单</div>
            </li>
            <li>
              <div class="logo3">3</div>
              <div class="goods">怡宝</div>
              <div class="cost">1094单</div>
            </li>
            <li>
              <div class="logo3">3</div>
              <div class="goods">怡宝</div>
              <div class="cost">1094单</div>
            </li>
            <li>
              <div class="logo3">3</div>
              <div class="goods">怡宝</div>
              <div class="cost">1094单</div>
            </li> -->
          </ul>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState } from 'vuex'
// import * as echarts from 'echarts'
// const myChart = echarts.init(this.$refs.left)
export default {

  data () {
    return {
    }
  },
  computed: {
    ...mapState('user', ['start', 'end', 'list'])
  },
  async  created () {
    const myDate = new Date()
    const start = `${myDate.getFullYear()}-${myDate.getMonth() + 1}-01`
    const end = `${myDate.getFullYear()}-${myDate.getMonth() + 1}-${myDate.getDate()}`
    await this.$store.dispatch('user/getshijian', { start, end })
    const topValue = 10
    await this.$store.dispatch('user/goodsList', { topValue, start, end })
  }
}
</script>

<style lang="scss" scoped>
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}
.bg-purple-left {
  background-color: #e9f3ff;
  background-image: url(),
    url(http://likede2-admin.itheima.net/img/task.66b715b7.png);
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, calc(100% - 12px) 100%;
  min-height: 166px !important;
  border-radius: 25px !important;
  .count {
    height: 50px;
    font-size: 36px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    line-height: 50px;
    color: #072074;
    text-shadow: 2px 4px 7px rgb(85 132 255 / 50%);
  }
  .des {
    height: 17px;
    margin-top: 3px;
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #91a7dc;
    line-height: 17px;
  }
}
.bg-purple-right {
  background: #fbefe8
    url(http://likede2-admin.itheima.net/img/sale.606b0d8c.png) no-repeat
    calc(100% - 12px) 100%;
  min-height: 166px !important;
  border-radius: 25px !important;
  .count {
    height: 50px;
    font-size: 36px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    line-height: 50px;
    color: #ff5757;
    text-shadow: 2px 4px 7px rgb(85 132 255 / 50%);
  }
  .des {
    height: 17px;
    margin-top: 3px;
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #ff5757;
    line-height: 17px;
  }
}
.header {
  display: flex;
  padding: 20px;
  .title {
    top: 20px;
    font-size: 16px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #333;
    span {
      margin-left: 10px;
      font-size: 12px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #999;
    }
  }
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
.rankings {
  width: 334px;
  height: 538px;
  margin-right: 0;
  background-color: #fff;
  border: 1px solid #fff;
  border-radius: 25px;
  ul {
    margin-top: 0px;
    li {
      position: relative;
      display: flex;
      justify-items: center;
      margin-bottom: 28px;

      .goods {
        margin-left: 30px;
      }
      .cost {
        position: absolute;
        right: 10px;
      }
    }
  }
}
.echarts-left {
  min-height: 166px !important;
  border-radius: 25px !important;
  background-color: green;
}
.echarts-right {
  min-height: 166px !important;
  border-radius: 25px !important;
  background-color: #ff5757;
}
.logo0 {
        text-align: center;
        line-height: 14px;
        width: 21px;
        height: 20px;
        background: url();
        color: #8e5900;
      }
      .logo1{
        text-align: center;
        line-height: 14px;
        width: 21px;
        height: 20px;
        background: url();
    color: #494949;
      }
      .logo2 {
        text-align: center;
        line-height: 14px;
        width: 21px;
        height: 20px;
        background: url();
    color: #cf6d3d;
      }
      .logo3{
        text-align: center;
        line-height: 14px;
        width: 21px;
        height: 20px;
        background: url();
    font-size: 12px;
      }
</style>
